package lab9;

public class Car {
	private long id;
	private static long currentID=0;
	private String model;
	private int maxSpeed;
	private int currentSpeed;
	private String color;
	private byte currentGear;
	private Person owner;
	public Car(String model, int maxSpeed, int currentSpeed, String color,
			byte currentGear, Person owner) {
		super();
		this.id=currentID++;
		this.model = model;
		this.maxSpeed = maxSpeed;
		this.currentSpeed = currentSpeed;
		this.color = color;
		this.currentGear = currentGear;
		this.owner=owner;
	}
	public String getModel() {
		return model;
	}
	public void setModel(String model) {
		this.model = model;
	}
	public int getMaxSpeed() {
		return maxSpeed;
	}
	public void setMaxSpeed(int maxSpeed) {
		this.maxSpeed = maxSpeed;
	}
	public int getCurrentSpeed() {
		return currentSpeed;
	}
	public void setCurrentSpeed(int currentSpeed) {
		this.currentSpeed = currentSpeed;
	}
	public String getColor() {
		return color;
	}
	public void setColor(String color) {
		this.color = color;
	}
	public byte getCurrentGear() {
		return currentGear;
	}
	public void setCurrentGear(byte currentGear) {
		this.currentGear = currentGear;
	}
	public long getId() {
		return id;
	}
	public void shiftGearUp()
	{
		if (this.currentGear>=6) System.out.println("Max gear reached");
		else currentGear++;
	}
	public void shiftGearDown()
	{
		if (this.currentGear<=-1) System.out.println("Min gear reached");
		else currentGear--;
	}
	@Override
	public String toString() {
		return "Car [id=" + id + ", model=" + model + ", maxSpeed=" + maxSpeed
				+ ", currentSpeed=" + currentSpeed + ", color=" + color
				+ ", currentGear=" + currentGear + ", owner=" + owner.toString() + "]";
	}
	public Person getOwner() {
		return owner;
	}
	public void setOwner(Person owner) {
		this.owner = owner;
	}
	
}
